package yhao.demo.autocode.demo;

import yhao.demo.autocode.core.sqlmapper.SqlModuleMapHelper;
import yhao.demo.autocode.core.sqlmapper.connect.DbConnectParam;
import yhao.demo.autocode.core.sqlmapper.connect.DbType;

/**
 * 数据库表直接转换成整个模块组件，
 *
 * <p>包括增删改查、微服务部署的代码
 *
 * @see SqlModuleMapHelper
 */
public class DbToModuleTest {
    public static void main(String[] args) throws Exception{
        testOracleSqlToModule();
        //testMysqlSqlToModule();
    }

    public static void testOracleSqlToModule() throws Exception {
        DbConnectParam param = new DbConnectParam(DbType.ORACLE,
                "jdbc:oracle:thin:@ (DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.44)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = qftest44)))",
                "yhao_base","yhao_base");
        SqlModuleMapHelper model = new SqlModuleMapHelper(param,"yhao_BASE",
                "T_SYSTEM_BIZ_CONFIG_CODE","f","com.yhao.oa.config",
                "com.yhao.oms.oa.web",
                "BizConfigCode","业务参数定义配置表","yoara");
        model.doMapper();
    }

    public static void testMysqlSqlToModule() throws Exception {
        DbConnectParam param = new DbConnectParam(DbType.MYSQL,
                "jdbc:mysql://192.168.0.155:4000/yhao?useSSL=false&amp;useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=round",
                "root","yhao.com");
        SqlModuleMapHelper model = new SqlModuleMapHelper(param,"yhao",
                "t_oa_notify_message","f","com.yhao.oa.erp",
                "com.yhao.oa.web.mgr",
                "Message","消息","yoara");
        model.doMapper();
    }
}
